using UnityEngine;

public class GotoItem : MonoBehaviour
{
	public UIEventListener gotobtn;

	public UILabel infolabel;

	public gotoinfo curgoto;

	public UISprite lockflag;

	public UISprite levelflag;

	private void Start()
	{
		gotobtn.onClick = OnClickgotoBtn;
	}

	public void enable(gotoinfo des)
	{
		curgoto = des;
		if (curgoto.curlv < 0)
		{
			switch (curgoto.curlv)
			{
				case -1:
					infolabel.text = "保卫基地";
					break;
				case -2:
					infolabel.text = "自由对战";
					break;
				case -3:
					infolabel.text = "生存";
					break;
				case -4:
					infolabel.text = "团队死亡竞赛";
					break;
				case -5:
					infolabel.text = "打开箱子";
					break;
			}
			if (curgoto.curlv != -5)
			{
				levelflag.enabled = false;
			}
			else
			{
				levelflag.spriteName = "CJ_xiangZi";
				levelflag.SetDimensions(40, 32);
				levelflag.enabled = true;
			}
		}
		else
		{
			infolabel.text = "关卡 " + (curgoto.curlv / 6 + 1) + "-" + (curgoto.curlv % 6 + 1);
			switch (MenuDataController.instance.levelinfo[curgoto.curlv].levelflag)
			{
				case 1:
					levelflag.spriteName = "ZY_biaoZhiFeiJi";
					levelflag.SetDimensions(40, 32);
					break;
				case 2:
					levelflag.spriteName = "ZY_biaoZhiJianZhu";
					levelflag.SetDimensions(40, 32);
					break;
				case 3:
					levelflag.spriteName = "ZY_biaoZhiZhanJian";
					levelflag.SetDimensions(40, 32);
					break;
			}
			levelflag.enabled = true;
		}
		if (curgoto.islock)
		{
			lockflag.enabled = true;
		}
		else
		{
			lockflag.enabled = false;
		}
	}

	public void OnClickgotoBtn(GameObject btn)
	{
		if (!curgoto.islock)
		{
			MonoInstance<AudioController>.instance.play(AudioType.UI_BTN, 0f);
			MenuUIController.instance.AutoFexdui(curgoto.curlv);
		}
	}
}
